using System;
using System.Xml.Serialization;

namespace Communication
{
    /// <summary>
    /// Represents a short message in undecoded PDU format.
    /// </summary>
    [Serializable, XmlInclude(typeof(ShortMessageFromPhone))]
    public class ShortMessage : IMessageIndicationObject
    {
        private string _alpha;
        private string _data;
        private int _length;

        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ShortMessage()
        {
            _alpha = string.Empty;
            _length = 0;
            _data = string.Empty;
        }

        /// <summary>
        /// Initializes a new instance of the ShortMessage class.
        /// </summary>
        /// <param name="alpha">The alphabet in which the message is encoded.</param>
        /// <param name="length">The length of the data.</param>
        /// <param name="data">The message.</param>
        public ShortMessage(string alpha, int length, string data)
        {
            Alpha = alpha;
            Length = length;
            Data = data;
        }

        /// <summary>
        /// The alphabet in which the message is encoded.
        /// </summary>
        [XmlAttribute]
        public string Alpha
        {
            get { return _alpha; }
            set { _alpha = value; }
        }

        /// <summary>
        /// The actual message.
        /// </summary>
        [XmlElement]
        public string Data
        {
            get { return _data; }
            set { _data = value; }
        }

        /// <summary>
        /// The length of the message. In PDU format, this is the actual length without the SMSC header.
        /// </summary>
        [XmlAttribute]
        public int Length
        {
            get { return _length; }
            set { _length = value; }
        }
    }
}